<template>
    <div>
        <div><input v-model="name"></div>
        <div><input v-model="password"></div>
        <p>{{ tip }}</p>
    </div>
</template>

<script>
import { ref, computed, watch } from "vue"
export default {
    setup() {
        const name = ref("");
        const password = ref("");
        const tip = ref("提示");

        watch(password, (newValue, oldValue) => {
            if (newValue) {
                tip.value = "密码过短"
            } else {
                tip.value = ""
            }
        })

        return {
            name,
            password,
            tip
        }
    }
}
</script>

<style></style>